<?php

namespace App\Http\Controllers\home;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;

class WupinController extends Controller
{
    // 
    public function getIndex(Request $request){
        // 获取物品id 
        $id = $request -> input('id');
       
        // 通过id获取商品数据
       $data =  DB::table('goods') -> where('id',$id)->first();

       // dd(session('id'));
       // 获取评论
       $pinglun = DB::table('pinglun') ->where('gname',$data['name']) -> get();
     $count = count($pinglun);
        return view('home/wupin/index',['data'=>$data,'pinglun'=>$pinglun,'count'=>$count]);
    }
}
